<% @page_title = "分享 | 多背一公斤 - 灾后学校重建计划" %>

<% content_for(:sidebar) do %>

<% end %>

<h1>上传照片</h1>
<% form_for :photos, :url => photos_url, :html => {:multipart => true} do |f| %>
  <% unless @school.blank? -%>
    <p>上传<%= link_to @school.title, school_url(@school.id) %>的照片</p>
  <% end -%>
  
  <% unless @event.blank? -%>
    <p>上传<%= link_to @event.title, event_url(@event.id) %>活动的照片</p>
  <% end -%>
  
  <% unless @student.blank? -%>
    <p>上传<%= link_to @student.full_name, student_url(@student.school.id, @student.id) %>的照片</p>
  <% end -%>
  
  <p><label for="upload_a_photo">上传照片：</label><span class="tip">照片大小不超过 2M</span></p>
  <% 1.upto(Photo.upload_amount) do |index| -%>
    <p><label for="photo<%= index %>">照片<%= index %>：</label><%= f.file_field "no_#{index}" %></p>
  <% end -%>
  <%= f.hidden_field :school_id %>
  <%= f.hidden_field :event_id %>
  <%= f.hidden_field :student_id %>
  <%= submit_tag "上 传" %>
<% end %>